<script setup lang="ts">
import type { User } from "@/types/user";
import { request } from "@/utils/request";
// import type { User } from "./types/user";
// import { useUserStore } from "./stores";

// 测试，请求拦截器，是否携带token，响应拦截器401拦截到登录地址
const getUserInfo = async () => {
  const res = await request.get("/patient/myUser");
  console.log(res);
};

// // 测试，响应拦截器，出现非10000的情况，和返回剥离后的数据
// const store = useUserStore();
const login = async () => {
  const res = await request.post<any, User>("/login/password", {
    mobile: "13211112222",
    // 密码 abc123456 测试：出现非10000的情况
    password: "abc123453",
  });
  // store.setUser(res);
  console.log("登录陈宫", res);
};
</script>

<template>
  <van-button type="primary" @click="getUserInfo">获取个人信息</van-button>
  <van-button type="primary" @click="login">登录</van-button>
  <svg aria-hidden="true">
    <!-- #icon-文件夹名称-图片名称 -->
    <use href="#icon-login-eye-off" />
    <use href="#icon-home-docs" />
  </svg>
  <cp-icon name="home-docs"></cp-icon>
  <cp-icon name="login-eye-off"></cp-icon>
</template>